home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / hamburge.swf / scripts / frame_90 / DoAction.as
Encoding:
Text File  |  2011-03-26  |  4.3 KB  |  172 lines

  1. cursorMove = new Object();
  2. cursorMove.onKeyDown = function()
  3. {
  4.    if(Key.getCode() == 77)
  5.    {
  6.       if(isBgmPlay == true)
  7.       {
  8.          _root.bgm.stop();
  9.          isBgmPlay = false;
  10.       }
  11.       else
  12.       {
  13.          _root.bgm.start(0,100000);
  14.          isBgmPlay = true;
  15.       }
  16.    }
  17.    if(Key.getCode() == 37)
  18.    {
  19.       if(cursorPosition > 1)
  20.       {
  21.          _root.moveS.start(0,l);
  22.          _root.cursor._x -= 67;
  23.          cursorPosition--;
  24.       }
  25.       else
  26.       {
  27.          cursorPosition = 8;
  28.          _root.cursor._x += 469;
  29.       }
  30.    }
  31.    if(Key.getCode() == 39)
  32.    {
  33.       if(cursorPosition < 8)
  34.       {
  35.          _root.moveS.start(0,l);
  36.          _root.cursor._x += 67;
  37.          cursorPosition++;
  38.       }
  39.       else
  40.       {
  41.          cursorPosition = 1;
  42.          _root.cursor._x -= 469;
  43.       }
  44.    }
  45.    if(Key.getCode() == 32)
  46.    {
  47.       if(isGamePlay == true)
  48.       {
  49.          if(cursorPosition == 8)
  50.          {
  51.             if(orderTyp == 1)
  52.             {
  53.                _root.bubS.start(0,1);
  54.                _root.make.cup.nextFrame();
  55.                if(_root.make.cup._currentframe == 13)
  56.                {
  57.                   _root.gotoAndPlay("noGood");
  58.                }
  59.             }
  60.             else
  61.             {
  62.                _root.noBtn.start(0,1);
  63.             }
  64.          }
  65.          else
  66.          {
  67.             downS.start(0,1);
  68.             _root.make["h" + cursorPosition].duplicateMovieClip("ham" + (_root.thisH + 1),_root.thisH + 10);
  69.             _root.make["ham" + (_root.thisH + 1)]._x = 200;
  70.             _root.make["ham" + (_root.thisH + 1)]._y = 100;
  71.             _root.make["ham" + (_root.thisH + 1)].targetX = 200;
  72.             if(_root.thisH > 0)
  73.             {
  74.                _root.make["ham" + (_root.thisH + 1)].targetY = _root.make["ham" + _root.thisH].targetY - _root["sTyp" + _root.nHamTyp[thisH - 1]];
  75.             }
  76.             else
  77.             {
  78.                _root.make["ham" + (_root.thisH + 1)].targetY = 445;
  79.             }
  80.             _root.make["ham" + (_root.thisH + 1)].isPlay = true;
  81.             _root.nHamTyp.push(cursorPosition);
  82.             if(cursorPosition != _root.hamTyp[_root.thisH])
  83.             {
  84.                _root.gotoAndPlay("noGood");
  85.             }
  86.             _root.thisH = _root.thisH + 1;
  87.          }
  88.       }
  89.    }
  90.    if(Key.getCode() == 13)
  91.    {
  92.       if(isGamePlay == true)
  93.       {
  94.          isGamePlay = false;
  95.          i = 0;
  96.          while(i < hamNum + 2)
  97.          {
  98.             if(_root.nHamTyp[i] != _root.hamTyp[i])
  99.             {
  100.                isGood = false;
  101.                break;
  102.             }
  103.             isGood = true;
  104.             i++;
  105.          }
  106.          if(orderTyp == 0)
  107.          {
  108.             if(isGood == true)
  109.             {
  110.                _root.score += 500 * (hamNum + 2);
  111.                _root.gotoAndPlay("good");
  112.             }
  113.             else
  114.             {
  115.                _root.gotoAndPlay("noGood");
  116.             }
  117.          }
  118.          else if(isGood == true && _root.make.cup._currentframe >= _root.make.cup.cupN._currentframe)
  119.          {
  120.             _root.score += 500 * (hamNum + 2) + 1000;
  121.             _root.colaNum = _root.colaNum + 1;
  122.             _root.gotoAndPlay("good");
  123.          }
  124.          else
  125.          {
  126.             _root.gotoAndPlay("noGood");
  127.          }
  128.       }
  129.    }
  130.    if(Key.isDown(35))
  131.    {
  132.       if(isGamePlay == true)
  133.       {
  134.          isGamePlay = false;
  135.          i = 0;
  136.          while(i < hamNum + 2)
  137.          {
  138.             if(_root.nHamTyp[i] != _root.hamTyp[i])
  139.             {
  140.                isGood = false;
  141.                break;
  142.             }
  143.             isGood = true;
  144.             i++;
  145.          }
  146.          if(orderTyp == 0)
  147.          {
  148.             if(isGood == true)
  149.             {
  150.                _root.score += 500 * (hamNum + 2);
  151.                _root.gotoAndPlay("good");
  152.             }
  153.             else
  154.             {
  155.                _root.gotoAndPlay("noGood");
  156.             }
  157.          }
  158.          else if(isGood == true && _root.make.cup._currentframe >= _root.make.cup.cupN._currentframe)
  159.          {
  160.             _root.score += 500 * (hamNum + 2) + 1000;
  161.             _root.colaNum = _root.colaNum + 1;
  162.             _root.gotoAndPlay("good");
  163.          }
  164.          else
  165.          {
  166.             _root.gotoAndPlay("noGood");
  167.          }
  168.       }
  169.    }
  170. };
  171. Key.addListener(cursorMove);
  172.